#include "solarradiometer2form.h"
#include "ui_solarradiometer2form.h"
#include "../../protocol/solarradiometerprotocol.h"
#include "../../dataBase/connection.h"
#include "../gloab/globalobserver.h"
#include "../gloab/mymessagebox.h"

#include<QRegularExpression>
#include <QSerialPortInfo>
#include <QUuid>
#include <QMutexLocker>
#include <QFile>

SolarRadiometer2Form::SolarRadiometer2Form(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::SolarRadiometer2Form)
    , m_port(new QSerialPort(this))
    , m_mutex()
{

    ui->setupUi(this);
    formInit();
    parseMapInit();
    connectInit();


}

SolarRadiometer2Form::~SolarRadiometer2Form()
{
    delete ui;
}

void SolarRadiometer2Form::slot_updateDeviceState(const protocol::RadioMeterSTAProtocolAll &point)
{
    ui->label_radioMeterStatus->setText(point.radioMeterStatus);
    ui->label_headTemperature->setText(QString::number(point.temperature));
    ui->label_headHumidity->setText(QString::number(point.humidity));
    ui->label_voltage->setText(QString::number(point.voltage));
    ui->label_errCode->setText(point.errCode);
    ui->label_heighAngle->setText(QString::number(point.heightAngle));
    ui->label_azimuthAngle->setText(QString::number(point.azimuthAngle));
    ui->label_turnTableStatus->setText(point.turnTableStatus);
    ui->label_powerStatus->setText(point.powerStatus);
}



void SolarRadiometer2Form::formInit()
{
    //刷新串口按钮
    connect(ui->btn_solorFelsehSerialPort, &QPushButton::clicked, this, [=](){
        ui->cbx_solorSerialPort->clear();
        QList<QSerialPortInfo> info_list = QSerialPortInfo::availablePorts();
        QStringList portList;
        QListIterator<QSerialPortInfo> iter(info_list);
        iter.toFront();
        while (iter.hasNext()) {
            QSerialPortInfo info = iter.next();
            portList.append(info.portName());
        }
        if(portList.empty()){
            ui->cbx_solorSerialPort->addItem("没有串口");

        }else{
            ui->cbx_solorSerialPort->addItems(portList);
        }

    } );

    //连接关闭串口
    connect(ui->btn_solorOpenClose, &QPushButton::clicked, this, [=](){
        if(ui->btn_solorOpenClose->text() == "连接"){
            if(ui->cbx_solorSerialPort->currentText().isEmpty()){
                MyMessageBox msgBox(this, MsgBoxType_Info, "串口未设置");
                msgBox.exec();
                return ;
            }

            QString port = ui->cbx_solorSerialPort->currentText();

            bool bl = openDevice(port);
            if(!bl){
                qDebug()<<"打开失败";
            }
            else{
                /*启动的时候清空一下之前所有的点*/
                emit Sig_sendsolorRadioMeterPortPoint(m_port);
                ui->btn_solorOpenClose->setText("断开");
            }
        }else{
            closeDevice();
            ui->btn_solorOpenClose->setText("连接");
        }
    });

    //获取状态信息按钮
    connect(ui->btn_solorQueryState, &QPushButton::clicked, this, [=](){
        if(-1 == m_port->write("STA\r\n")){
            MyMessageBox msgBox(this, MsgBoxType_Info, "太阳辐射计未连接");
            msgBox.exec();
        }
    });

    //设置密集测量时间间隔
    connect(ui->btn_solorSetInter, &QPushButton::clicked, this, [=](){
        QByteArray ary = "SetTimeSpan,";
        QString time = ui->spinBox_SolorSetInter->text();
        if(time.length() == 1){
            ary.append("0");
        }
        ary.append(ui->spinBox_SolorSetInter->text().toLatin1());
        ary.append("\r\n");

        if(-1 == m_port->write(ary)){

            MyMessageBox msgBox(this, MsgBoxType_Info, "太阳辐射计未连接");
            msgBox.exec();

        }
    });

    //设置纬度时限定范围为 0.00-90.00 但是可以输入90.xx
    QRegularExpression regexLon("^([1-9]?[0-9]|1[0-8][0-9]|180)(\\.[0-9]?[0-9]?)?$");
    QRegularExpressionValidator *lonValidator = new QRegularExpressionValidator(regexLon, this);
    ui->edit_longitude->setValidator(lonValidator);

    //设置经度时限定范围为 0.00-180.00 但是可以输入180.xx
    QRegularExpression regexLat("^([1-8]?[0-9]|90)(\\.[0-9]{1,2})?$");
    //QRegularExpression regexLat( "^(((([0-9]|[1-9][0-9]|1[0-7][0-9])(\\.\\d{1,2})|180)?),)+(((([0-9]|[1-9][0-9]|1[0-7][0-9])(\\.\\d{1,2})|180)?))$");
    QRegularExpressionValidator *latValidator = new QRegularExpressionValidator(regexLat, this);
    ui->edit_latitude->setValidator(latValidator);

    //设置纬度
    connect(ui->btn_solorSetLat, &QPushButton::clicked, this, [=](){
        if(ui->edit_latitude->text().isEmpty()){
            MyMessageBox msgBox(this, MsgBoxType_Info, "纬度未填写");
            msgBox.exec();
            return ;
        }
        QByteArray ary = "Lat,";
        ary.append(ui->edit_latitude->text().toLatin1());
        ary.append("\r\n");
        if(-1 == m_port->write(ary)){
            MyMessageBox msgBox(this, MsgBoxType_Info, "太阳辐射计未连接");
            msgBox.exec();
        }

    });

    //设置经度
    connect(ui->btn_solorSetLon, &QPushButton::clicked, this, [=](){
        if(ui->edit_latitude->text().isEmpty()){

            MyMessageBox msgBox(this, MsgBoxType_Info, "经度未填写");
            msgBox.exec();
            return ;
        }else if(ui->edit_longitude->text().toDouble() > 180){

            MyMessageBox msgBox(this, MsgBoxType_Info, "经度超出范围（0~180°）");
            msgBox.exec();
            return ;
        }

        QByteArray ary = "Lon,";
        //注意有空格
        ary.append("-");
        ary.append(ui->edit_longitude->text().toLatin1());
        ary.append("\r\n");
        if(-1 == m_port->write(ary)){

            MyMessageBox msgBox(this, MsgBoxType_Info, "太阳辐射计未未连接");
            msgBox.exec();
        }
    });

    //下载数据
    /*connect(ui->btn_solorDownloadData, &QPushButton::clicked, this, [=](){
        if(ui->edit_solorBeginTime->dateTime() > ui->edit_solorEndTime->dateTime()){
            QMessageBox::StandardButton box;
            box = QMessageBox::information(this, tr("提示"),"结束时间先于起始时间");
            return;
        }
        if(ui->edit_solorBeginTime->dateTime().daysTo(ui->edit_solorEndTime->dateTime()) > 184){//6个月最长为184天
            QMessageBox::StandardButton box;
            box = QMessageBox::information(this, tr("提示"),"时间跨度超出6个月");
            return;
        }

        QByteArray ary = "ReadData,";
        ary.append(ui->edit_solorBeginTime->dateTime().toString("yyMMddHH").toLatin1());
        ary.append('-');
        ary.append(ui->edit_solorEndTime->dateTime().toString("yyMMddHH").toLatin1());
        ary.append("\r\n");
        if(-1 == m_port->write(ary)){
            QMessageBox::StandardButton box;
            box = QMessageBox::information(this, tr("提示"),"设备未连接");
        }
        QFile file("D:/solorDownload.txt");
        //以读写的方式打开文件，成功返回true，失败返回false
        //想用其他方式打开文件，请看上面的文件打开模式
        bool ok = file.open(QIODevice::ReadWrite);
        while(0){
            QByteArray ary2 = this->m_port->readAll();
            qDebug()<<ary2;
            //每段话写入一次文件，出现Data Download Complete 结束下载数据
            if(ary2.indexOf("\r\n") > 0){
                file.write(ary2);
                if(ary2.indexOf("Data Download Complete") > 0)
                    break;
                ary2.clear();
            }
        }
        file.close();
    });*/
}

void SolarRadiometer2Form::parseMapInit()
{
    //接收到对应的数据头，调用对应的解析数据函数
    m_parseMap["NS"] = [this](const QByteArray& ary){ this->parseNSU(ary);};
    m_parseMap["ST"] = [this](const QByteArray& ary){ this->parseSTA(ary);};
    m_parseMap["AO"] = [this](const QByteArray& ary){ this->parseAOD(ary);};
    m_parseMap["AT"] = [this](const QByteArray& ary){ this->parseATR(ary);};
    m_parseMap["LA"] = [this](const QByteArray& ary){ this->parseLAT(ary);};
    m_parseMap["LO"] = [this](const QByteArray& ary){ this->parseLON(ary);};
    m_parseMap["Az"] = [this](const QByteArray& ary){ this->parseAZ(ary);};
    m_parseMap["Ei"] = [this](const QByteArray& ary){ this->parseEI(ary);};
    m_parseMap["SY"] = [this](const QByteArray& ary){ this->parseSYSTEMRESET(ary);};
    m_parseMap["SE"] = [this](const QByteArray& ary){ this->parseSETTIMESPAN(ary);};
}

void SolarRadiometer2Form::connectInit()
{
    //STA协议解析后直接在本界面进行更新
    connect(this, &SolarRadiometer2Form::Sig_DeviceSolarRadioMeterProtocolSTA, this, &SolarRadiometer2Form::slot_updateDeviceState);

    connect(this, &SolarRadiometer2Form::Sig_DeviceSolarRadioMeterProtocolAOD, GlobalObserver::getInstance(), &GlobalObserver::Sig_SolarRadioMeterProtocolAOD);
    connect(this, &SolarRadiometer2Form::Sig_DeviceSolarRadioMeterProtocolATR, GlobalObserver::getInstance(), &GlobalObserver::Sig_SolarRadioMeterProtocolATR);
    connect(this, &SolarRadiometer2Form::Sig_DeviceSolarRadioMeterProtocolLAT, GlobalObserver::getInstance(), &GlobalObserver::Sig_SolarRadioMeterProtocolLAT);
    connect(this, &SolarRadiometer2Form::Sig_DeviceSolarRadioMeterProtocolLON, GlobalObserver::getInstance(), &GlobalObserver::Sig_SolarRadioMeterProtocolLON);
    connect(this, &SolarRadiometer2Form::Sig_DeviceSolarRadioMeterProtocolNSU, GlobalObserver::getInstance(), &GlobalObserver::Sig_SolarRadioMeterProtocolNSU);
    connect(this, &SolarRadiometer2Form::Sig_DeviceSolarRadioMeterProtocolSTA, GlobalObserver::getInstance(), &GlobalObserver::Sig_SolarRadioMeterProtocolSTA);
    //数据反演
    connect( GlobalObserver::getInstance(), &GlobalObserver::Sig_solorRadioMeterGetSTA, this, [=](){
        if(-1 == m_port->write("STA\r\n")){

            MyMessageBox msgBox(this, MsgBoxType_Info, "太阳辐射计断开连接");
            msgBox.exec();
        }
    });

    connect(this, &SolarRadiometer2Form::Sig_sendsolorRadioMeterPortPoint, GlobalObserver::getInstance(), &GlobalObserver::Sig_SolorRadioMeterSendPortPoint);
}

bool SolarRadiometer2Form::openDevice(QString portName)
{
    m_port->setPortName(portName);
    m_port->setBaudRate(115200);
    m_port->setDataBits(QSerialPort::Data8);
    m_port->setStopBits(QSerialPort::OneStop);
    m_port->setParity(QSerialPort::NoParity);
    m_port->setFlowControl(QSerialPort::NoFlowControl);
    m_port->setReadBufferSize(4096);
    if(m_port->open(QSerialPort::ReadWrite)){
        qDebug()<<"打开成功";
        connect(this->m_port.data(), &QSerialPort::errorOccurred, this, [=](QSerialPort::SerialPortError err){
            qDebug()<<"错误信息 : "<<this->m_port->errorString();
        });
        connect(this->m_port.data(), &QSerialPort::readyRead, this, [=](){
            //可读或者m_readBuffer中还有数据，都说明还有数据，继续解析。
            if(this->m_port->bytesAvailable() || !m_readBuffer.isEmpty()){
                QByteArray ary = this->m_port->readAll();

                qDebug()<<"rec arr:"<<ary<<"\n ary.length: "<<ary.length();

                this->m_readBuffer.append(ary);
                if(m_readBuffer.indexOf("\r\n") >= 0){
                    qDebug()<<"m_readBuffer:"<<m_readBuffer<<"\n m_readBuffer.length: "<<m_readBuffer.length();
                    //判断数据头和处理
                    QByteArray head = m_readBuffer.left(2);
                    //根据数据头不同调用不同解析函数
                    if(head == "NS"){
                        m_parseMap["NS"](m_readBuffer.mid(0, m_readBuffer.indexOf("\r\n")));
                    }
                    else if(head == "ST"){
                    //    m_parseMap["ST"](m_readBuffer.mid(0, m_readBuffer.indexOf("\r\n")));
                    }else if(head == "AO"){
                        m_parseMap["AO"](m_readBuffer.mid(0, m_readBuffer.indexOf("\r\n")));
                    }else if(head == "AT"){
                        m_parseMap["AT"](m_readBuffer.mid(0, m_readBuffer.indexOf("\r\n")));
                    }
                    //1. 删除意外接收到的数据 |不完整数据\r\n|完整数据\r\n| 删除前面的不完整数据
                    //2. 数据已经完成解析，可以删除
                    m_readBuffer.remove(0, m_readBuffer.indexOf("\r\n") + 4);
                }
            }
            /*
            if(this->m_port->bytesAvailable() || !m_readBuffer.isEmpty()){
                QByteArray ary = this->m_port->readAll();
                qDebug()<<"rec arr:"<<ary<<"ary.length: "<<ary.length();
                this->m_readBuffer.append(ary);

                if(m_readBuffer.length() > 2){
                    QByteArray head = m_readBuffer.left(2);
                    qDebug()<<"m_readBuffer:"<<m_readBuffer<<"\nm_readBuffer.length: "<<m_readBuffer.length();
                    //根据数据头不同调用不同解析函数
                    if(head == "NS"){
                        if(m_readBuffer.length() >= RADIO_NSUPROTOCOL_LEN){
                            m_parseMap["NS"](m_readBuffer.mid(0, RADIO_NSUPROTOCOL_LEN));
                            m_readBuffer.remove(0, RADIO_NSUPROTOCOL_LEN);
                        }
                    }
                    else if(head == "ST"){
                        if(m_readBuffer.length() >= RADIO_STAPROTOCOL_LEN){
                            //最后有可能是OK也有可能是LOW导致长度不定，进行判断
                            int end = m_readBuffer.indexOf("OK");
                            if(end > 0){
                                m_parseMap["ST"](m_readBuffer.mid(0, end + 2));
                                m_readBuffer.remove(0, end + 2);
                            }else if(m_readBuffer.indexOf("LOW") > 0){
                                end = m_readBuffer.indexOf("LOW");
                                m_parseMap["ST"](m_readBuffer.mid(0, end + 3));
                                m_readBuffer.remove(0, end + 3);
                            }
                        }
                    }else if(head == "AO"){
                        if(m_readBuffer.length() >= RADIO_AODPROTOCOL_LEN){
                            m_parseMap["AO"](m_readBuffer.mid(0, RADIO_AODPROTOCOL_LEN));
                            m_readBuffer.remove(0, RADIO_AODPROTOCOL_LEN);
                        }
                    }else if(head == "AT"){
                        if(m_readBuffer.length() >= RADIO_ATRPROTOCOL_LEN){
                            m_parseMap["AT"](m_readBuffer.mid(0, RADIO_ATRPROTOCOL_LEN));
                        }
                    }else{
                        m_readBuffer.remove(0, m_readBuffer.length());
                    }
                }
            }*/

        });
        return true;
    }

    return false;
}

void SolarRadiometer2Form::closeDevice()
{
    m_port->close();
}

//解析NSU协议
void SolarRadiometer2Form::parseNSU(const QByteArray &ary)
{
    QString str = ary;
    QStringList protocoList = str.split(',');
    //协议三次太阳辐射计测量值的间隔
    int interval = 10;
    protocol::RadioMeterNSUProtocolAll protocol;
    QDate date = QDate::fromString(protocoList[1], "yyyy/MM/dd");
    QTime time = QTime::fromString(protocoList[2], "HH:mm:ss");
    protocol.dateTime = QDateTime(date, time);

    protocol.sun1020 = (protocoList[3].toDouble() + protocoList[3 + interval].toDouble() + protocoList[3 + interval*2].toDouble())/3;
    protocol.sun1640I = (protocoList[4].toDouble()+ protocoList[4 + interval].toDouble() + protocoList[4 + interval*2].toDouble())/3;
    protocol.sun870 = (protocoList[5].toDouble()+ protocoList[5 + interval].toDouble() + protocoList[5 + interval*2].toDouble())/3;
    protocol.sun675 = (protocoList[6].toDouble()+ protocoList[6 + interval].toDouble() + protocoList[6 + interval*2].toDouble())/3;
    protocol.sun440 = (protocoList[7].toDouble()+ protocoList[7 + interval].toDouble() + protocoList[7 + interval*2].toDouble())/3;
    protocol.sun500 = (protocoList[8].toDouble()+ protocoList[8 + interval].toDouble() + protocoList[8 + interval*2].toDouble())/3;
    protocol.sun1020I = (protocoList[9].toDouble()+ protocoList[9 + interval].toDouble() + protocoList[9 + interval*2].toDouble())/3;
    protocol.sun937 = (protocoList[10].toDouble()+ protocoList[10 + interval].toDouble() + protocoList[10 + interval*2].toDouble())/3;
    protocol.sun380 = (protocoList[11].toDouble()+ protocoList[11 + interval].toDouble() + protocoList[11 + interval*2].toDouble())/3;
    protocol.sun340 = (protocoList[12].toDouble()+ protocoList[12 + interval].toDouble() + protocoList[12 + interval*2].toDouble())/3;
    protocol.headTemperature = protocoList[33].toDouble();
    protocol.ambientTemperature = protocoList[34].toDouble();
    protocol.airPressure = protocoList[35].toDouble();



    emit Sig_DeviceSolarRadioMeterProtocolNSU(protocol);

    QUuid uuid = QUuid::createUuid();
    int dataStartIndex = 24;
    QByteArray encodedData = ary.mid(dataStartIndex, ary.length() - dataStartIndex).toBase64();
    qDebug()<<"base64 :"<<encodedData;
    QString strSql = QString("INSERT INTO \"TESTDBA\".\"solarradiometerNSU\"(\"uuid\",\"dateTime\",\"base64Data\")"
                             "VALUES('%1','%2','%3');").arg(uuid.toString()).arg(protocol.dateTime.toString("yyyy/MM/dd HH/mm/ss"))
                         .arg(ary.mid(dataStartIndex, ary.length() - dataStartIndex).toBase64());
    Connection::getInstance()->update(strSql);
}
//解析STA协议
void SolarRadiometer2Form::parseSTA(const QByteArray &ary)
{
    QString str = ary;
    QStringList protocolList = str.split(',');
    protocol::RadioMeterSTAProtocolAll protocol;

    QDate date = QDate::fromString(protocolList[1], "yyyy/MM/dd");
    QTime time = QTime::fromString(protocolList[2], "HH:mm:ss");
    protocol.dateTime = QDateTime(date, time);

    protocol.radioMeterStatus = protocolList[3].split(':')[1];
    protocol.temperature = protocolList[4].split(':')[1].toDouble();
    protocol.humidity = protocolList[5].split(':')[1].toDouble();
    protocol.voltage = protocolList[6].split(':')[1].toDouble();
    protocol.errCode = protocolList[7].split(':')[1];
    protocol.heightAngle = protocolList[8].split(':')[1].toDouble();//高度角
    protocol.azimuthAngle = protocolList[9].split(':')[1].toDouble();//方位角
    protocol.turnTableStatus = protocolList[10].split(':')[1];
    protocol.powerStatus = protocolList[11];

    emit Sig_DeviceSolarRadioMeterProtocolSTA(protocol);
    QUuid uuid = QUuid::createUuid();
    int dataStartIndex = 24;
    QByteArray encodedData = ary.mid(dataStartIndex, ary.length() - dataStartIndex).toBase64();
    qDebug()<<"base64 :"<<encodedData;
    QString strSql = QString("INSERT INTO \"TESTDBA\".\"solarradiometerNSU\"(\"uuid\",\"dateTime\",\"base64Data\")"
                             "VALUES('%1','%2','%3');").arg(uuid.toString()).arg(protocol.dateTime.toString("yyyy/MM/dd HH/mm/ss"))
                         .arg(ary.mid(dataStartIndex, ary.length() - dataStartIndex).toBase64());
    Connection::getInstance()->update(strSql);
}

//解析AOD协议
void SolarRadiometer2Form::parseAOD(const QByteArray &ary)
{
    QString str = ary;
    QStringList protocoList = str.split(',');

    protocol::RadioMeterAODProtocolAll protocol;
    QDate date = QDate::fromString(protocoList[1], "yyyy/MM/dd");
    QTime time = QTime::fromString(protocoList[2], "HH:mm:ss");
    protocol.dateTime = QDateTime(date, time);

    protocol.sun1020 = protocoList[3].toDouble() ;
    protocol.sun1640I = protocoList[4].toDouble();
    protocol.sun870 = protocoList[5].toDouble();
    protocol.sun675 = protocoList[6].toDouble();
    protocol.sun440 = protocoList[7].toDouble();
    protocol.sun500 = protocoList[8].toDouble();
    protocol.sun1020I = protocoList[9].toDouble();
    protocol.sun937 = protocoList[10].toDouble();
    protocol.sun380 = protocoList[11].toDouble();
    protocol.sun340 = protocoList[12].toDouble();
    protocol.PWV = protocoList[13].toDouble();

    emit Sig_DeviceSolarRadioMeterProtocolAOD(protocol);
    QUuid uuid = QUuid::createUuid();
    int dataStartIndex = 24;
    QByteArray encodedData = ary.mid(dataStartIndex, ary.length() - dataStartIndex).toBase64();
    qDebug()<<"base64 :"<<encodedData;
    QString strSql = QString("INSERT INTO \"TESTDBA\".\"solarradiometerNSU\"(\"uuid\",\"dateTime\",\"base64Data\")"
                             "VALUES('%1','%2','%3');").arg(uuid.toString()).arg(protocol.dateTime.toString("yyyy/MM/dd HH/mm/ss"))
                         .arg(ary.mid(dataStartIndex, ary.length() - dataStartIndex).toBase64());
    Connection::getInstance()->update(strSql);

}

//解析AOD协议
void SolarRadiometer2Form::parseATR(const QByteArray &ary)
{
    QString str = ary;
    QStringList protocoList = str.split(',');

    protocol::RadioMeterATRProtocolAll protocol;
    QDate date = QDate::fromString(protocoList[1], "yyyy/MM/dd");
    QTime time = QTime::fromString(protocoList[2], "HH:mm:ss");
    protocol.dateTime = QDateTime(date, time);

    protocol.sun1020 = protocoList[3].toDouble() ;
    protocol.sun1640I = protocoList[4].toDouble();
    protocol.sun870 = protocoList[5].toDouble();
    protocol.sun675 = protocoList[6].toDouble();
    protocol.sun440 = protocoList[7].toDouble();
    protocol.sun500 = protocoList[8].toDouble();
    protocol.sun1020I = protocoList[9].toDouble();
    protocol.sun937 = protocoList[10].toDouble();
    protocol.sun380 = protocoList[11].toDouble();
    protocol.sun340 = protocoList[12].toDouble();

    emit Sig_DeviceSolarRadioMeterProtocolATR(protocol);
    QUuid uuid = QUuid::createUuid();
    int dataStartIndex = 24;
    QByteArray encodedData = ary.mid(dataStartIndex, ary.length() - dataStartIndex).toBase64();
    qDebug()<<"base64 :"<<encodedData;
    QString strSql = QString("INSERT INTO \"TESTDBA\".\"solarradiometerNSU\"(\"uuid\",\"dateTime\",\"base64Data\")"
                             "VALUES('%1','%2','%3');").arg(uuid.toString()).arg(protocol.dateTime.toString("yyyy/MM/dd HH/mm/ss"))
                         .arg(ary.mid(dataStartIndex, ary.length() - dataStartIndex).toBase64());
    Connection::getInstance()->update(strSql);
}


void SolarRadiometer2Form::parseLAT(const QByteArray &ary)
{
    QString lat = ary;
    QStringList list = lat.split(",");
    lat = list[1];
    emit Sig_DeviceSolarRadioMeterProtocolLAT(lat);
}

void SolarRadiometer2Form::parseLON(const QByteArray &ary)
{
    QString lon = ary;
    QStringList list = lon.split(",");
    lon = list[1];
    emit Sig_DeviceSolarRadioMeterProtocolLON(lon);
}


void SolarRadiometer2Form::parseAZ(const QByteArray &ary)
{

}

void SolarRadiometer2Form::parseEI(const QByteArray &ary)
{

}



void SolarRadiometer2Form::parseSYSTEMRESET(const QByteArray &ary)
{

}

void SolarRadiometer2Form::parseSETTIMESPAN(const QByteArray &ary)
{

}
